<?php
class cmsDeleteAction extends sfActions
{
    public function execute($request)
    {
		$notify = "delFailed";
		
    	$cms_id = $request->getParameter('cms_id');
        $this->forward404Unless($cms = Doctrine_Core::getTable('VTNSCms')->findOneByCmsId($cms_id), sprintf('Bài viết này không tồn tại (%s).',$cms_id));
		if ($cms->deleteCmsAndPictures())
			$notify = "delSuccess";
       
      	$this->redirect('cms/cmsList?cms_category_id='.$cms->cms_category_id.'&notify='.$notify);
       	return sfView::SUCCESS;
    }
}
?>